﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Web.UI;
using System.Web.UI.WebControls;
using EnvironmentManagerSystem.MODE;
using EnvironmentManagerSystem.BLL;
using EnvironmentManagerSystem.Utility;
using System.Collections;
using System.Configuration;
using System.Web.Security;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls.WebParts;
using System.IO;
using System.Text;
using System.Drawing;

namespace EnvironmentManagerSystem.HuanTong
{
    public partial class GuiDangBiao : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (StfInfo.ReSession()) return; if (!IsPostBack)
            {
                //QQ();
                ShowProcessing();
                BindUsername();
            }
        }

        #region 权限按钮(x)
        private void QQ()
        {
            //受理情况
            if (BLL.ren.GetQ(int.Parse(Session["RYID"].ToString()), "5"))
            {
                Button5.Enabled = true;//正式受理
                Button6.Enabled = true;//项目退回
            }
            else
            {
                Button5.Enabled = false;
                Button6.Enabled = false;
            }
            //人员分配
            if (BLL.ren.GetQ(int.Parse(Session["RYID"].ToString()), "6"))
            {
                Button22.Enabled = true;//分配确认
            }
            else
            {
                Button22.Enabled = false;
            }
            //起草批复
            if (BLL.ren.GetQ(int.Parse(Session["RYID"].ToString()), "7"))
            {
                Button19.Enabled = true;//批复确认
            }
            else
            {
                Button19.Enabled = false;
            }
            //处长审查
            if (BLL.ren.GetQ(int.Parse(Session["RYID"].ToString()), "8"))
            {
                Button21.Enabled = true;//处长确认
                Button4.Enabled = true;//项目退回
            }
            else
            {
                Button21.Enabled = false;
                Button4.Enabled = true;
            }
            //厅长签发
            if (BLL.ren.GetQ(int.Parse(Session["RYID"].ToString()), "9"))
            {
                Button3.Enabled = true;//项目退回
                Button14.Enabled = true;//厅长确认
            }
            else
            {
                Button3.Enabled = false;
                Button14.Enabled = false;
            }
        }
        #endregion

        #region 按钮(项目日志、项目受理、人员分配、起草批复、处长审查、厅长签发)(x)
        #region 项目日志(x)
        protected void Button2_Click(object sender, EventArgs e)
        {
            if (txtLog.Text.Trim() == string.Empty)
            {
                Jscript.Alert("请输入项目日志！", this);
                return;
            }
            bool result = HuanPingService.UpdateProjectLog(txtLog.Text.Trim());
            if (!result)
                Jscript.Alert("项目日志保存失败！", this);
            else
                ShowProcessing();
        }
        #endregion

        #region 项目受理(x)
        protected void Button5_Click(object sender, EventArgs e)
        {
            int cailiaoqiquan = 0;
            if (CheckBox2.Checked == true)
            {
                cailiaoqiquan = 1;
            }
            else
            {
                cailiaoqiquan = 0;
            }
            string jinjiqingk = "";
            if (rbP.Checked == true)
            {
                jinjiqingk = "普通";
            }
            else if (rbJ.Checked == true)
            {
                jinjiqingk = "急";
            }
            else if (rbTJ.Checked == true)
            {
                jinjiqingk = "特急";
            }
            if (HuanPingService.ProAcceptance(cailiaoqiquan, jinjiqingk))
            {
                Jscript.Alert("正式受理成功!", this);
                ShowProcessing();
            }
            else { Jscript.Alert("正式受理失败!", this); }
        }
        #endregion

        #region 人员分配(x)
        protected void Button22_Click(object sender, EventArgs e)
        {
            string renyuanfeipei = "";
            if (txtDifficulty0.SelectedItem.Text.Trim() != "请选择")
            {
                renyuanfeipei = txtDifficulty0.SelectedItem.Text.Trim();
            }
            else
            {
                renyuanfeipei = txtDifficulty0.SelectedItem.Text.Trim();
            }

            if (HuanPingService.Pro(renyuanfeipei))
            {
                Jscript.Alert("人员分配成功!", this);
                ShowProcessing();
            }
            else
            {
                Jscript.Alert("人员分配失败!", this);
            }
        }
        #endregion

        #region 起草批复(x)
        protected void Button19_Click(object sender, EventArgs e)
        {
            string Qicaojilu = tbQicaojilu.Text;
            if (HuanPingService.Prowenjian(Qicaojilu))
            {
                Jscript.Alert("起草批复成功!", this);
                ShowProcessing();
            }
            else
            {
                Jscript.Alert("起草批复失败!", this);
            }
        }
        #endregion

        #region 处长审查(x)
        protected void Button21_Click(object sender, EventArgs e)
        {
            string Chuzhangjilu = tbChuzhangjilu.Text;
            if (HuanPingService.ProShangchuan(Chuzhangjilu))
            {
                Jscript.Alert("处长审查成功!", this);
                ShowProcessing();
            }
            else
            {
                Jscript.Alert("处长审查失败!", this);
            }
        }
        #endregion

        #region 厅长签发(x)
        protected void Button14_Click(object sender, EventArgs e)
        {
            string Tingzhangjilu = tbTingzhangjilu.Text;
            if (HuanPingService.ProQianfa(Tingzhangjilu))
            {
                Jscript.Alert("厅长签发成功!", this);
                ShowProcessing();
            }
            else
            {
                Jscript.Alert("厅长签发失败!", this);
            }
        }
        #endregion

        #endregion

        #region 显示当前流程状态(x)
        private void ShowProcessing()
        {
            if (Session["ZhiNeng"].ToString() != "")
            {
                DataTable dt = HuanPingService.GetProjectInfo();
                if (dt.Rows.Count == 0)
                    return;
                xiangmurizhi.Text = dt.Rows[0]["LogTrace"].ToString().Trim();//项目日主痕迹
                shouli.Text = dt.Rows[0]["shouliTrace"].ToString().Trim();//项目受理痕迹
                labDepartmentBack.Text = dt.Rows[0]["renyuanTrace"].ToString().Trim();//人员分配痕迹
                lbiyichuli.Text = dt.Rows[0]["wenjianTrace"].ToString().Trim();//起草文件痕迹
                labXiangMuKaoPing.Text = dt.Rows[0]["querenTrace"].ToString().Trim();//上传厅长痕迹
                labReportOK.Text = dt.Rows[0]["qianfaTrace"].ToString().Trim();//厅长签发痕迹
                Session["hpID"] = dt.Rows[0]["ID"].ToString().Trim();//ID
                Session["renyuanfeipei"] = dt.Rows[0]["renyuanfeipei"].ToString().Trim();//人员分配
                //显示数据
                txtLog.Text = dt.Rows[0]["ProjectLog"].ToString();//项目日志     
                tbQicaojilu.Text = dt.Rows[0]["qicaojilu"].ToString();//起草记录
                tbChuzhangjilu.Text = dt.Rows[0]["chuzhangjilu"].ToString();//处长记录
                tbTingzhangjilu.Text = dt.Rows[0]["tingzhanglilu"].ToString();//厅长记录
                if (dt.Rows[0]["cailiaoqiquan"].ToString().Trim() == "0")
                    CheckBox2.Checked = false;
                if (dt.Rows[0]["cailiaoqiquan"].ToString().Trim() == "1")
                    CheckBox2.Checked = true;
                if (dt.Rows[0]["jinjiqingkuang"].ToString().Trim() == "普通")
                    rbP.Checked = true;
                else if (dt.Rows[0]["jinjiqingkuang"].ToString().Trim() == "急")
                    rbJ.Checked = true;
                else if (dt.Rows[0]["jinjiqingkuang"].ToString().Trim() == "特急")
                    rbTJ.Checked = true;
                else
                    rbP.Checked = true;
                DataTable dts = ren.GetList();
                if (dts.Rows.Count == 0)
                    return;
                //流程限制
                bool TZ = Session["ZhiNeng"].ToString().Contains("厅长");
                bool CZ = Session["ZhiNeng"].ToString().Contains("处长");
                bool JBR = Session["ZhiNeng"].ToString().Contains("经办人");
                bool SLR = Session["ZhiNeng"].ToString().Contains("受理人");
                string wenjian = dt.Rows[0]["wenjian"].ToString();//wenjian
                string renyuan = Session["renyuanfeipei"].ToString();

                #region if (TZ == true)//厅长
                if (TZ == true)//厅长
                {
                    //项目受理按钮状态
                    if ((dt.Rows[0]["shoulituihui"].ToString().Trim() != "1"))
                    {
                        this.Button5.Enabled = true;//项目受理
                        this.Button6.Enabled = true;//项目退回
                        this.Button22.Enabled = false;//人员分配
                        this.Button19.Enabled = false;//起草批复
                        this.Button21.Enabled = false;//处长审察
                        this.Button4.Enabled = false;//处长退回
                        this.Button14.Enabled = false;//厅长签发 
                        this.Button3.Enabled = false;//厅长退回 
                    }
                    //人员分配按钮状态
                    else if ((dt.Rows[0]["shoulituihui"].ToString().Trim() == "1") && (dt.Rows[0]["querenfenpei"].ToString().Trim() != "1"))
                    {
                        this.Button5.Enabled = false;//项目受理
                        this.Button6.Enabled = false;//项目退回
                        this.Button22.Enabled = true;//人员分配
                        this.Button19.Enabled = false;//起草批复
                        this.Button21.Enabled = false;//处长审察
                        this.Button4.Enabled = false;//处长退回
                        this.Button14.Enabled = false;//厅长签发
                        this.Button3.Enabled = false;//厅长退回 
                        CheckBox2.Enabled = false;
                        txtbeizhu0.Enabled = false;
                    }
                    //起草批复按钮状态
                    //else if ((dt.Rows[0]["shoulituihui"].ToString().Trim() == "1") && (dt.Rows[0]["querenfenpei"].ToString().Trim() == "1") && (dt.Rows[0]["wenjian"].ToString().Trim() != "1"))
                    //{
                    //    if (renyuan == Session["UserName"].ToString())//分配人员
                    //    {
                    //        this.Button5.Enabled = false;//项目受理
                    //        this.Button6.Enabled = false;//项目退回
                    //        this.Button22.Enabled = false;//人员分配
                    //        this.Button19.Enabled = true;//起草批复
                    //        this.Button21.Enabled = false;//处长审察
                    //        this.Button4.Enabled = false;//处长退回
                    //        this.Button14.Enabled = false;//厅长签发
                    //        this.Button3.Enabled = false;//厅长退回 
                    //        txtDifficulty0.Enabled = false;
                    //        CheckBox2.Enabled = false;
                    //        txtbeizhu0.Enabled = false;
                    //    }
                    //    else
                    //    {
                    //        this.Button5.Enabled = false;
                    //        this.Button6.Enabled = false;
                    //        this.Button22.Enabled = false;//人员分配
                    //        this.Button19.Enabled = false;//起草批复
                    //        this.Button21.Enabled = false;//处长审察
                    //        this.Button4.Enabled = false;//处长退回
                    //        this.Button14.Enabled = false;//厅长签发
                    //        this.Button3.Enabled = false;//厅长退回 
                    //        txtDifficulty0.Enabled = false;
                    //        CheckBox2.Enabled = false;
                    //        txtbeizhu0.Enabled = false;
                    //    }
                    //}
                    //处长审察按钮状态
                    //else if ((dt.Rows[0]["shoulituihui"].ToString().Trim() == "1") && (dt.Rows[0]["querenfenpei"].ToString().Trim() == "1") && (dt.Rows[0]["wenjian"].ToString().Trim() == "1") && (dt.Rows[0]["querenshangchuan"].ToString().Trim() != "1"))
                    //{
                    //    this.Button5.Enabled = false;
                    //    this.Button6.Enabled = false;
                    //    this.Button22.Enabled = false;//人员分配
                    //    this.Button19.Enabled = false;//起草批复
                    //    this.Button21.Enabled = true;//处长审察
                    //    this.Button4.Enabled = true;//处长退回
                    //    this.Button14.Enabled = false;//厅长签发
                    //    this.Button3.Enabled = false;//厅长退回 
                    //    CheckBox2.Enabled = false;
                    //    txtDifficulty0.Enabled = false;
                    //    txtbeizhu0.Enabled = false;
                    //}
                    //厅长签发按钮状态
                    else if ((dt.Rows[0]["shoulituihui"].ToString().Trim() == "1") && (dt.Rows[0]["querenfenpei"].ToString().Trim() == "1") && (dt.Rows[0]["wenjian"].ToString().Trim() == "1") && (dt.Rows[0]["querenshangchuan"].ToString().Trim() == "1") && (dt.Rows[0]["qianfa"].ToString().Trim() != "1"))
                    {
                        this.Button5.Enabled = false;
                        this.Button6.Enabled = false;
                        this.Button22.Enabled = false;//人员分配
                        this.Button19.Enabled = false;//起草批复
                        this.Button21.Enabled = false;//处长审察
                        this.Button4.Enabled = false;//处长退回
                        this.Button14.Enabled = true;//厅长签发
                        this.Button3.Enabled = true;//厅长退回 
                        CheckBox2.Enabled = false;
                        txtDifficulty0.Enabled = false;
                        txtbeizhu0.Enabled = false;
                    }
                    else
                    {
                        this.Button5.Enabled = false;//项目受理
                        this.Button6.Enabled = false;//项目退回
                        this.Button22.Enabled = true;//人员分配
                        this.Button19.Enabled = false;//起草批复
                        this.Button21.Enabled = false;//处长审察
                        this.Button4.Enabled = false;//处长退回
                        this.Button14.Enabled = false;//厅长签发
                        this.Button3.Enabled = false;//厅长退回 
                        CheckBox2.Enabled = false;
                        txtDifficulty0.Enabled = false;
                        txtbeizhu0.Enabled = false;
                    }
                }
                #endregion

                #region if (CZ == true)//处长
                if (CZ == true)//处长
                {
                    //项目受理按钮状态
                    if ((dt.Rows[0]["shoulituihui"].ToString().Trim() != "1"))
                    {
                        this.Button5.Enabled = true;//项目受理
                        this.Button6.Enabled = true;//项目退回
                        this.Button22.Enabled = false;//人员分配
                        this.Button19.Enabled = false;//起草批复
                        this.Button21.Enabled = false;//处长审察
                        this.Button4.Enabled = false;//处长退回
                        this.Button14.Enabled = false;//厅长签发 
                        this.Button3.Enabled = false;//厅长退回 
                    }
                    //人员分配按钮状态
                    else if ((dt.Rows[0]["shoulituihui"].ToString().Trim() == "1") && (dt.Rows[0]["querenfenpei"].ToString().Trim() != "1"))
                    {
                        this.Button5.Enabled = false;//项目受理
                        this.Button6.Enabled = false;//项目退回
                        this.Button22.Enabled = true;//人员分配
                        this.Button19.Enabled = false;//起草批复
                        this.Button21.Enabled = false;//处长审察
                        this.Button4.Enabled = false;//处长退回
                        this.Button14.Enabled = false;//厅长签发
                        this.Button3.Enabled = false;//厅长退回 
                        CheckBox2.Enabled = false;
                        txtbeizhu0.Enabled = false;

                    }
                    //起草批复按钮状态
                    //else if ((dt.Rows[0]["shoulituihui"].ToString().Trim() == "1") && (dt.Rows[0]["querenfenpei"].ToString().Trim() == "1") && (dt.Rows[0]["wenjian"].ToString().Trim() != "1"))
                    //{
                    //    if (renyuan == Session["UserName"].ToString())//分配人员
                    //    {
                    //        this.Button5.Enabled = false;
                    //        this.Button6.Enabled = false;
                    //        this.Button22.Enabled = false;//人员分配
                    //        this.Button19.Enabled = true;//起草批复
                    //        this.Button21.Enabled = false;//处长审察
                    //        this.Button4.Enabled = false;//处长退回
                    //        this.Button14.Enabled = false;//厅长签发
                    //        this.Button3.Enabled = false;//厅长退回 
                    //        txtDifficulty0.Enabled = false;
                    //        CheckBox2.Enabled = false;
                    //        txtbeizhu0.Enabled = false;
                    //    }
                    //    else
                    //    {
                    //        this.Button5.Enabled = false;
                    //        this.Button6.Enabled = false;
                    //        this.Button22.Enabled = false;//人员分配
                    //        this.Button19.Enabled = false;//起草批复
                    //        this.Button21.Enabled = false;//处长审察
                    //        this.Button4.Enabled = false;//处长退回
                    //        this.Button14.Enabled = false;//厅长签发
                    //        this.Button3.Enabled = false;//厅长退回 
                    //        txtDifficulty0.Enabled = false;
                    //        CheckBox2.Enabled = false;
                    //        txtbeizhu0.Enabled = false;
                    //    }
                    //}
                    //处长审察按钮状态
                    else if ((dt.Rows[0]["shoulituihui"].ToString().Trim() == "1") && (dt.Rows[0]["querenfenpei"].ToString().Trim() == "1") && (dt.Rows[0]["wenjian"].ToString().Trim() == "1") && (dt.Rows[0]["querenshangchuan"].ToString().Trim() != "1"))
                    {
                        this.Button5.Enabled = false;
                        this.Button6.Enabled = false;
                        this.Button22.Enabled = false;//人员分配
                        this.Button19.Enabled = false;//起草批复
                        this.Button21.Enabled = true;//处长审察
                        this.Button4.Enabled = true;//处长退回
                        this.Button14.Enabled = false;//厅长签发
                        this.Button3.Enabled = false;//厅长退回 
                        CheckBox2.Enabled = false;
                        txtDifficulty0.Enabled = false;
                        txtbeizhu0.Enabled = false;
                    }
                    else
                    {
                        this.Button5.Enabled = false;
                        this.Button6.Enabled = false;
                        this.Button22.Enabled = false;//人员分配
                        this.Button19.Enabled = false;//起草批复
                        this.Button21.Enabled = false;//处长审察
                        this.Button4.Enabled = false;//处长退回
                        this.Button14.Enabled = false;//厅长签发
                        this.Button3.Enabled = false;//厅长退回 
                        CheckBox2.Enabled = false;
                        txtDifficulty0.Enabled = false;
                        txtbeizhu0.Enabled = false;
                    }
                }
                #endregion

                #region if (JBR == true)//经办人
                if (JBR == true)//经办人
                {
                    ////项目受理按钮状态
                    //if ((dt.Rows[0]["shoulituihui"].ToString().Trim() != "1"))
                    //{
                    //    this.Button5.Enabled = true;
                    //    this.Button6.Enabled = true;
                    //    this.Button22.Enabled = false;//人员分配
                    //    this.Button19.Enabled = false;//起草批复
                    //    this.Button21.Enabled = false;//处长审察
                    //    this.Button4.Enabled = false;//处长退回
                    //    this.Button14.Enabled = false;//厅长签发  
                    //    this.Button3.Enabled = false;//厅长退回 
                    //}
                    ////人员分配按钮状态
                    //else if ((dt.Rows[0]["shoulituihui"].ToString().Trim() == "1") && (dt.Rows[0]["querenfenpei"].ToString().Trim() != "1"))
                    //{
                    //    this.Button5.Enabled = false;
                    //    this.Button6.Enabled = false;
                    //    this.Button22.Enabled = true;//人员分配
                    //    this.Button19.Enabled = false;//起草批复
                    //    this.Button21.Enabled = false;//处长审察
                    //    this.Button4.Enabled = false;//处长退回
                    //    this.Button14.Enabled = false;//厅长签发
                    //    this.Button3.Enabled = false;//厅长退回 
                    //    CheckBox2.Enabled = false;
                    //    txtbeizhu0.Enabled = false;
                    //}
                    //起草批复按钮状态
                    if ((dt.Rows[0]["shoulituihui"].ToString().Trim() == "1") && (dt.Rows[0]["querenfenpei"].ToString().Trim() == "1") && (dt.Rows[0]["wenjian"].ToString().Trim() != "1"))
                    {
                        if (renyuan == Session["UserName"].ToString())//分配人员
                        {
                            this.Button5.Enabled = false;
                            this.Button6.Enabled = false;
                            this.Button22.Enabled = false;//人员分配
                            this.Button19.Enabled = true;//起草批复
                            this.Button21.Enabled = false;//处长审察
                            this.Button4.Enabled = false;//处长退回
                            this.Button14.Enabled = false;//厅长签发
                            this.Button3.Enabled = false;//厅长退回 
                            txtDifficulty0.Enabled = false;
                            CheckBox2.Enabled = false;
                            txtbeizhu0.Enabled = false;
                        }
                        else
                        {
                            this.Button5.Enabled = false;
                            this.Button6.Enabled = false;
                            this.Button22.Enabled = false;//人员分配
                            this.Button19.Enabled = false;//起草批复
                            this.Button21.Enabled = false;//处长审察
                            this.Button4.Enabled = false;//处长退回
                            this.Button14.Enabled = false;//厅长签发
                            this.Button3.Enabled = false;//厅长退回 
                            txtDifficulty0.Enabled = false;
                            CheckBox2.Enabled = false;
                            txtbeizhu0.Enabled = false;
                        }
                    }
                }
                #endregion

                #region if (SLR == true)//受理人
                if (SLR == true)//受理人
                {
                    //项目受理按钮状态
                    if ((dt.Rows[0]["shoulituihui"].ToString().Trim() != "1"))
                    {
                        this.Button5.Enabled = true;//项目受理
                        this.Button6.Enabled = true;//项目退回
                        this.Button22.Enabled = false;//人员分配
                        this.Button19.Enabled = false;//起草批复
                        this.Button21.Enabled = false;//处长审察
                        this.Button4.Enabled = false;//处长退回
                        this.Button14.Enabled = false;//厅长签发 
                        this.Button3.Enabled = false;//厅长退回 
                    }
                    else
                    {
                        this.Button5.Enabled = false;//项目受理
                        this.Button6.Enabled = false;//项目退回
                        this.Button22.Enabled = false;//人员分配
                        this.Button19.Enabled = false;//起草批复
                        this.Button21.Enabled = false;//处长审察
                        this.Button4.Enabled = false;//处长退回
                        this.Button14.Enabled = false;//厅长签发 
                        this.Button3.Enabled = false;//厅长退回 
                    }
                }
                #endregion
            }
        }
        #endregion

        #region DropDownList绑定(x)
        public void BindUsername()
        {
            txtDifficulty0.DataSource = ren.GetList();
            txtDifficulty0.DataTextField = "username";
            txtDifficulty0.DataValueField = "ID";
            txtDifficulty0.DataBind();
            if (Session["ZhiNeng"].ToString() != "")
            {
                if (Session["pjName"].ToString() != "无")
                {
                    if (Session["renyuanfeipei"].ToString() != "")
                    {
                        txtDifficulty0.SelectedItem.Text = Session["renyuanfeipei"].ToString();
                    }
                }
            }
        }
        protected void txtDifficulty0_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
        #endregion

        #region 项目退回(x)
        protected void Button6_Click(object sender, EventArgs e)
        {
            string a = "";
            if (txtbeizhu0.Text == "")
                a = "无";
            else
                a = txtbeizhu0.Text;
            if (BLL.HuanJing.EditTable("UPDATE tbs001_developprojectbasicinfo SET reportstate=2,tuihui='" + a + "' WHERE ProjectName = '" + Session["pjName"].ToString() + "' ") > 0)
            {
                ShowProcessing();
                #region 删除项目(x)
                string ProjectName = Session["pjName"].ToString();//项目名称
                if (HuanPingService.DELHuanPing(ProjectName) > 0)
                {
                }
                #endregion
                Jscript.Alert("项目退回成功!", this);
            }
            else
            {
                Jscript.Alert("项目退回失败!", this);
            }
        }
        #endregion

        #region 按钮(处长退回,厅长退回)(x)
        #region 处长退回
        protected void Button4_Click(object sender, EventArgs e)
        {
            #region 环评中心
            if (RadioButton6.Checked == true)
            {
                string RB6YuanYin2 = "";
                if (txtYuanYin2.Text == "")
                    RB6YuanYin2 = "无";
                else
                    RB6YuanYin2 = txtYuanYin2.Text;
                if (BLL.HuanJing.EditTable("UPDATE tbs001_developprojectbasicinfo SET reportstate=2,tuihui='" + RB6YuanYin2 + "' WHERE ProjectName = '" + Session["pjName"].ToString() + "' ") > 0)
                {
                    ShowProcessing();
                    #region 删除项目(x)
                    string ProjectName = Session["pjName"].ToString();//项目名称
                    if (HuanPingService.DELHuanPing(ProjectName) > 0)
                    {
                    }
                    #endregion
                    Jscript.Alert("厅长退回成功!", this);
                }
                else
                {
                    Jscript.Alert("厅长退回失败!", this);
                }
            }
            #endregion

            #region 起草批复
            if (RadioButton9.Checked == true)
            {
                string RB9YuanYin2 = "";
                if (txtYuanYin1.Text == "")
                    RB9YuanYin2 = "无";
                else
                    RB9YuanYin2 = txtYuanYin1.Text;
                if (BLL.HuanJing.EditTable("UPDATE tbs001_huanping SET wenjian=0,qicaowenjianrenyuan=NULL,qicaowenjianshijian=NULL,chuzhangtuihuiyuanyin = '" + RB9YuanYin2 + "',wenjianTrace=CONCAT(wenjianTrace,'|" + HttpContext.Current.Session["UserName"].ToString() + "已于" + DateTime.Now.Date.ToString("yyyy-MM-dd") + "进行厅长退回操作)'),dangqianliucheng='起草批复' WHERE ProjectName = '" + Session["pjName"].ToString() + "'") > 0)
                {
                    ShowProcessing();
                    Jscript.Alert("处长退回成功!", this);
                }
                else
                {
                    Jscript.Alert("处长退回失败!", this);
                }
            }
            #endregion
        }
        #endregion

        #region 厅长退回
        protected void Button3_Click(object sender, EventArgs e)
        {
            #region 环评中心
            if (RadioButton1.Checked == true)
            {
                string RB1YuanYin1 = "";
                if (txtYuanYin1.Text == "")
                    RB1YuanYin1 = "无";
                else
                    RB1YuanYin1 = txtYuanYin1.Text;
                if (BLL.HuanJing.EditTable("UPDATE tbs001_developprojectbasicinfo SET reportstate=2,tuihui='" + RB1YuanYin1 + "' WHERE ProjectName = '" + Session["pjName"].ToString() + "' ") > 0)
                {
                    ShowProcessing();
                    #region 删除项目(x)
                    string ProjectName = Session["pjName"].ToString();//项目名称
                    if (HuanPingService.DELHuanPing(ProjectName) > 0)
                    {
                    }
                    #endregion
                    Jscript.Alert("厅长退回成功!", this);
                }
                else
                {
                    Jscript.Alert("厅长退回失败!", this);
                }
            }
            #endregion

            #region 起草批复
            if (RadioButton4.Checked == true)
            {
                string RB4YuanYin1 = "";
                if (txtYuanYin1.Text == "")
                    RB4YuanYin1 = "无";
                else
                    RB4YuanYin1 = txtYuanYin1.Text;
                if (BLL.HuanJing.EditTable("UPDATE tbs001_huanping SET wenjian=0,qicaowenjianrenyuan=NULL,qicaowenjianshijian=NULL,chuzhangtuihuiyuanyin = '" + RB4YuanYin1 + "',querenshangchuan=0,shangchuantingzrenyuan=NULL,shangchuantingzhangshijian=NULL,wenjianTrace=CONCAT(wenjianTrace,'|" + HttpContext.Current.Session["UserName"].ToString() + "已于" + DateTime.Now.Date.ToString("yyyy-MM-dd") + "进行厅长退回操作)'),dangqianliucheng='起草批复' WHERE ProjectName = '" + Session["pjName"].ToString() + "'") > 0)
                {
                    ShowProcessing();
                    Jscript.Alert("厅长退回成功!", this);
                }
                else
                {
                    Jscript.Alert("厅长退回失败!", this);
                }
            }
            #endregion

            #region 处长审查
            if (RadioButton5.Checked == true)
            {
                string RB5YuanYin1 = "";
                if (txtYuanYin1.Text == "")
                    RB5YuanYin1 = "无";
                else
                    RB5YuanYin1 = txtYuanYin1.Text;
                if (BLL.HuanJing.EditTable("UPDATE tbs001_huanping SET querenshangchuan=0,shangchuantingzrenyuan=NULL,shangchuantingzhangshijian=NULL,tingzhangtuihuiyuanyin='" + RB5YuanYin1 + "',querenTrace=CONCAT(querenTrace,'|" + HttpContext.Current.Session["UserName"].ToString() + "已于" + DateTime.Now.Date.ToString("yyyy-MM-dd") + "进行厅长退回操作)'),dangqianliucheng='处长审查' WHERE ProjectName = '" + Session["pjName"].ToString() + "'") > 0)
                {
                    ShowProcessing();
                    Jscript.Alert("厅长退回成功!", this);
                }
                else
                {
                    Jscript.Alert("厅长退回失败!", this);
                }
            }
            #endregion
        }
        #endregion
        #endregion

        #region 连接下载(x)
        //评估报告
        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
            DataTable dt = XIANGMU.GetProjectInfo();
            //OfficeHelper.DownFile1(this, Server.MapPath(dt.Rows[0]["pinggubaogaoURL"].ToString()));
            OfficeHelper.DownFile1(this, Server.MapPath("../HuanJing/") + (dt.Rows[0]["pinggubaogaoURL"].ToString()));
        }
        #endregion
    }
}